package com.example.dbmysql.service.impl;

import com.example.dbmysql.mapper.LadderMapper;
import com.example.dbmysql.pojo.LadderControl;
import com.example.dbmysql.service.LadderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;


@Service
public class LadderServiceImpl implements LadderService {
    @Autowired
    private LadderMapper ladderMapper;

    @Override
    public void add(LadderControl ladderControl) {
        ladderMapper.add(ladderControl);
    }

    @Override
    public List<LadderControl> selectAll() {

        return  ladderMapper.selectAll();
    }

    @Override
    public LadderControl selectByfloorAndpublic(String publicFloor, String publicFloor1) {

        return  ladderMapper.selectByfloorAndpublic(publicFloor,publicFloor1);
    }

    @Override
    public LadderControl selectById(Integer id) {
        return ladderMapper.selectById(id);
    }

    @Override
    public void update(LadderControl ladderControl) {
        ladderControl.setUpdateTimer(LocalDateTime.now());
        ladderMapper.update(ladderControl);
    }

    @Override
    public void delById(Integer id) {
        ladderMapper.delById(id);
    }
}
